<template>
  <div class="login">
    用户名：
    <input
      type="text"
      v-model="username"
    />
    <br />
    密码：<input
      type="text"
      v-model="password"
    />
    <br />
    <input
      type="button"
      value="登录"
      @click="login"
    />
  </div>
</template>
<script>
export default {
  data() {
    return {
      username: '',
      password: ''
    }
  },
  methods: {
    login() {
      // 1. 发送登录的网络请求成功之后返回token
      const token = 'FSLDJKFLKDSJFLKDSJFLKDSJFLSJF'
      localStorage.setItem('token', token)
      // 2. 跳转到首页
      this.$router.push('/home')
    }
  }
}
</script>
<style lang="scss" scoped></style>
